<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/vue.js"></script>
</head>
<body>
<div id='root'>
    <input type="text" v-model="firstName">
    <input type="text" v-model="lastName">
    <h1 v-text="fullName()">{{fullName()}}</h1>

</div>
<script>
    var vm = new Vue({
        el: '#root',
        data: {
            firstName: "zhang",
            lastName: "san"
        },
        /** 计算属性
         computed: {
            fullName: function () {
                return this.firstName + "  " + this.lastName;
            }
        }
         **/

        /** 方法
         methods:{
            fullName:function() {
                return this.firstName+this.lastName;
            }
        }
         */
        watch: {

        }

    })
</script>
</body>
</html>